package com.cy.law.db.entity;

import com.cy.law.db.strategy.GenericStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "hk_unit", schema = "zhifayi", catalog = "")
public class HkUnit {
    private Integer unitType;
    private String parentTree;
    private Long createTime;
    private Integer unitLevel;
    private String name;
    private String indexCode;
    private Long updateTime;
    private String parentIndexCode;

    @Basic
    @Column(name = "unit_type")
    public Integer getUnitType() {
        return unitType;
    }

    public void setUnitType(Integer unitType) {
        this.unitType = unitType;
    }

    @Basic
    @Column(name = "parent_tree")
    public String getParentTree() {
        return parentTree;
    }

    public void setParentTree(String parentTree) {
        this.parentTree = parentTree;
    }

    @Basic
    @Column(name = "create_time")
    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "unit_level")
    public Integer getUnitLevel() {
        return unitLevel;
    }

    public void setUnitLevel(Integer unitLevel) {
        this.unitLevel = unitLevel;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Id
    @GenericGenerator(name = "HkUnit", strategy = GenericStrategy.ASSIGNED)
    @GeneratedValue(generator = "HkUnit")
    @Column(name = "index_code")
    public String getIndexCode() {
        return indexCode;
    }

    public void setIndexCode(String indexCode) {
        this.indexCode = indexCode;
    }

    @Basic
    @Column(name = "update_time")
    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    @Basic
    @Column(name = "parent_index_code")
    public String getParentIndexCode() {
        return parentIndexCode;
    }

    public void setParentIndexCode(String parentIndexCode) {
        this.parentIndexCode = parentIndexCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        HkUnit hkUnit = (HkUnit) o;
        return Objects.equals(unitType, hkUnit.unitType) &&
                Objects.equals(parentTree, hkUnit.parentTree) &&
                Objects.equals(createTime, hkUnit.createTime) &&
                Objects.equals(unitLevel, hkUnit.unitLevel) &&
                Objects.equals(name, hkUnit.name) &&
                Objects.equals(indexCode, hkUnit.indexCode) &&
                Objects.equals(updateTime, hkUnit.updateTime) &&
                Objects.equals(parentIndexCode, hkUnit.parentIndexCode);
    }

    @Override
    public int hashCode() {
        return Objects.hash(unitType, parentTree, createTime, unitLevel, name, indexCode, updateTime, parentIndexCode);
    }
}
